package pe.com.slcsccy.aegis.model.dao;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

import pe.com.slcsccy.aegis.model.beans.Ruta;
import pe.com.slcsccy.aegis.model.beans.RutaExample;

import com.ibatis.sqlmap.client.SqlMapClient;

@Repository("rutaDAO")
public class RutaDAOImpl extends SqlMapClientDaoSupport implements RutaDAO {

    /**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table ruta
	 * @ibatorgenerated  Sat May 19 03:00:51 COT 2012
	 */
	public RutaDAOImpl() {
		super();
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table ruta
	 * @ibatorgenerated  Sat May 19 03:00:51 COT 2012
	 */
	public int countByExample(RutaExample example) {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject(
				"ruta.ibatorgenerated_countByExample", example);
		return count;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table ruta
	 * @ibatorgenerated  Sat May 19 03:00:51 COT 2012
	 */
	public int deleteByExample(RutaExample example) {
		int rows = getSqlMapClientTemplate().delete(
				"ruta.ibatorgenerated_deleteByExample", example);
		return rows;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table ruta
	 * @ibatorgenerated  Sat May 19 03:00:51 COT 2012
	 */
	public int deleteByPrimaryKey(Long idRuta) {
		Ruta key = new Ruta();
		key.setIdRuta(idRuta);
		int rows = getSqlMapClientTemplate().delete(
				"ruta.ibatorgenerated_deleteByPrimaryKey", key);
		return rows;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table ruta
	 * @ibatorgenerated  Sat May 19 03:00:51 COT 2012
	 */
	public void insert(Ruta record) {
		getSqlMapClientTemplate().insert("ruta.ibatorgenerated_insert", record);
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table ruta
	 * @ibatorgenerated  Sat May 19 03:00:51 COT 2012
	 */
	public void insertSelective(Ruta record) {
		getSqlMapClientTemplate().insert(
				"ruta.ibatorgenerated_insertSelective", record);
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table ruta
	 * @ibatorgenerated  Sat May 19 03:00:51 COT 2012
	 */
	@SuppressWarnings("unchecked")
	public List<Ruta> selectByExample(RutaExample example) {
		List<Ruta> list = getSqlMapClientTemplate().queryForList(
				"ruta.ibatorgenerated_selectByExample", example);
		return list;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table ruta
	 * @ibatorgenerated  Sat May 19 03:00:51 COT 2012
	 */
	public Ruta selectByPrimaryKey(Long idRuta) {
		Ruta key = new Ruta();
		key.setIdRuta(idRuta);
		Ruta record = (Ruta) getSqlMapClientTemplate().queryForObject(
				"ruta.ibatorgenerated_selectByPrimaryKey", key);
		return record;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table ruta
	 * @ibatorgenerated  Sat May 19 03:00:51 COT 2012
	 */
	public int updateByExampleSelective(Ruta record, RutaExample example) {
		UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
		int rows = getSqlMapClientTemplate().update(
				"ruta.ibatorgenerated_updateByExampleSelective", parms);
		return rows;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table ruta
	 * @ibatorgenerated  Sat May 19 03:00:51 COT 2012
	 */
	public int updateByExample(Ruta record, RutaExample example) {
		UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
		int rows = getSqlMapClientTemplate().update(
				"ruta.ibatorgenerated_updateByExample", parms);
		return rows;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table ruta
	 * @ibatorgenerated  Sat May 19 03:00:51 COT 2012
	 */
	public int updateByPrimaryKeySelective(Ruta record) {
		int rows = getSqlMapClientTemplate().update(
				"ruta.ibatorgenerated_updateByPrimaryKeySelective", record);
		return rows;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table ruta
	 * @ibatorgenerated  Sat May 19 03:00:51 COT 2012
	 */
	public int updateByPrimaryKey(Ruta record) {
		int rows = getSqlMapClientTemplate().update(
				"ruta.ibatorgenerated_updateByPrimaryKey", record);
		return rows;
	}

	/**
	 * This class was generated by Apache iBATIS ibator. This class corresponds to the database table ruta
	 * @ibatorgenerated  Sat May 19 03:00:51 COT 2012
	 */
	private static class UpdateByExampleParms extends RutaExample {
		private Object record;

		public UpdateByExampleParms(Object record, RutaExample example) {
			super(example);
			this.record = record;
		}

		public Object getRecord() {
			return record;
		}
	}

	@Autowired
    public void createSqlMapClient(@Qualifier("sqlMapClient")  SqlMapClient sqlMapClient){
      setSqlMapClient(sqlMapClient);
    }

    @Override
    public List<Ruta> selectByNombre(Map<String,Object> parametros) {
        List<Ruta> list = getSqlMapClientTemplate().queryForList(
                "ruta.selectByNombre", parametros);
        return list;
    }
    
    @Override
    public List<Ruta> selectByNombreExacto(Map<String,Object> parametros) {
        List<Ruta> list = getSqlMapClientTemplate().queryForList(
                "ruta.selectByNombreExacto", parametros);
        return list;
    }   
    
    
}